<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
	<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/js/easyui/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/js/easyui/themes/icon.css">
	<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.8.3.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/js/easyui/jquery.easyui.min.js"></script>
	 <link rel="stylesheet"
	  href="${pageContext.request.contextPath}/js/ztree/zTreeStyle.css" type="text/css">
	<script type="text/javascript"
	 src="${pageContext.request.contextPath}/js/ztree/jquery.ztree.all-3.5.js"></script>
	<script type="text/javascript">
		var setting = {};
 		var zNodes = [
		              {name:'节点一',children:[
		                                    {name:'节点11'},
		                                    {name:'节点12'},
		                                    {name:'节点13'}
		                                    ]},
		              {name:'节点二'},
		              {name:'节点三'}
		              ];
		$(function(){
			$.fn.zTree.init($("#myTree"),setting,zNodes);
		});
	</script>
</head>
<body class="easyui-layout">   
    <div data-options="region:'north',title:'页眉',split:true" style="height:100px;">北部</div>   
    <div data-options="region:'south',title:'页脚',split:true" style="height:100px;">南部</div>   
    <div data-options="region:'east',iconCls:'icon-reload',title:'快捷栏',split:true" style="width:100px;">东部</div>   
    <div data-options="region:'west',title:'系统菜单',split:true" style="width:150px;">
		<div id="ee" class="easyui-accordion" data-options="fit:true">
			<div title="分类一" data-options="iconCls:'icon-search'">
				<a id="baidulink" onclick="addTab()" class="easyui-linkbutton">百度</a>
				<script>
					function addTab(){
						$("#tabs").tabs("add",{
							iconCls:'icon-help',
							closable:true,
							title:'百度',
							content:'<iframe frameborder="0" width="100%" height="100%" src="http://www.baidu.com"></iframe>'
						});
					}
				</script>
				
			</div>
			<div title="分类二" data-options="iconCls:'icon-search'">
				<ul id="myTree" class="ztree"></ul>
			
			</div>
				
			<div title="分类三" data-options="iconCls:'icon-search'">
				<ul id="myTree2" class="ztree"></ul>
				<script>
				function onClick(event, treeId, treeNode, clickFlag) {
					//alert(treeNode.name);
					var page = treeNode.page;
					if(page != undefined){
						//判断当前选项卡是否存在
						var ex = $("#tabs").tabs("exists",treeNode.name);
						if(ex){
							//已经存在，选中选项卡
							$("#tabs").tabs("select",treeNode.name);
						}else{
							//不存在，添加
							//动态添加选项卡面板
							$("#tabs").tabs("add",{
								closable:true,
								title:treeNode.name,
								content:'<iframe frameborder="0" width="100%" height="100%" src="'+page+'"></iframe>'
							});
						}
					}
				};
					var setting2 = {
							data: {
								simpleData: {
									enable: true
								}
							},
							callback: {
								onClick: onClick
							}
					};
					var zNodes2 = [
									{ id:1, pId:0, name:"父节点1 - 展开", open:true},
									{ id:11, pId:1, name:"父节点11 - 折叠"},
									{ id:111, pId:11, name:"叶子节点111"},
									{ id:112, pId:11, name:"京东",page:'http://www.jd.com'},
									{ id:113, pId:11, name:"淘宝",page:'http://www.taobao.com'},
									{ id:114, pId:11, name:"百度",page:'http://www.baidu.com'},
									{ id:114, pId:11, name:"dmzj",page:'http://www.dmzj.com'}
					               ];
					$(function(){
						$.fn.zTree.init($("#myTree2"), setting2, zNodes2);
					});
				</script>
			</div>
		</div>
	</div>   
    <div data-options="region:'center',title:'详细信息'" style="padding:5px;background:#eee;">
    	<div id="tabs" class="easyui-tabs" data-options="fit:true">
	    	<div id="tab1" class="easyui-tab" title="选项卡一" data-options="closable:true">
	    		选项卡一
	    	</div>
	   		 <div id="tab2" class="easyui-tab" title="选项卡二" data-options="closable:true,iconCls:'icon-reload'">
	    		选项卡二
	    	</div>
	    	<div id="tab3" class="easyui-tab" title="选项卡三" data-options="closable:true">
	    		选项卡三
	    	</div>
    	</div>
    </div>   
</body> 
</html>